 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.





Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKJdw/JdwModel.h>

@implementation NodeType
-(id) initWithNodeTypeValue:(NSString*) nodeTypeValue
      cpu:(NSNumber*)cpu
      memory:(NSNumber*)memory
      storage:(NSNumber*)storage
      miniNodeNumber:(NSNumber*)miniNodeNumber
      maxNodeNumber:(NSNumber*)maxNodeNumber { 
     self.nodeTypeValue = nodeTypeValue;               
     self.cpu = cpu;               
     self.memory = memory;               
     self.storage = storage;               
     self.miniNodeNumber = miniNodeNumber;               
     self.maxNodeNumber = maxNodeNumber;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self nodeTypeValue])
    {
        [result setValue:[self nodeTypeValue] forKey:@"nodeType"];
    }
    if([self cpu])
    {
        [result setValue:[self cpu] forKey:@"cpu"];
    }
    if([self memory])
    {
        [result setValue:[self memory] forKey:@"memory"];
    }
    if([self storage])
    {
        [result setValue:[self storage] forKey:@"storage"];
    }
    if([self miniNodeNumber])
    {
        [result setValue:[self miniNodeNumber] forKey:@"miniNodeNumber"];
    }
    if([self maxNodeNumber])
    {
        [result setValue:[self maxNodeNumber] forKey:@"maxNodeNumber"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.nodeTypeValue = [dictionary objectForKey:@"nodeType"];
    self.cpu = [dictionary objectForKey:@"cpu"];
    self.memory = [dictionary objectForKey:@"memory"];
    self.storage = [dictionary objectForKey:@"storage"];
    self.miniNodeNumber = [dictionary objectForKey:@"miniNodeNumber"];
    self.maxNodeNumber = [dictionary objectForKey:@"maxNodeNumber"];
    return self;
}
 @end
@implementation Node
-(id) initWithNodeRole:(NSString*) nodeRole
      nodeStatus:(NSString*)nodeStatus
      cpuUtilization:(NSString*)cpuUtilization
      memoryUtilization:(NSString*)memoryUtilization
      diskUtilization:(NSString*)diskUtilization { 
     self.nodeRole = nodeRole;               
     self.nodeStatus = nodeStatus;               
     self.cpuUtilization = cpuUtilization;               
     self.memoryUtilization = memoryUtilization;               
     self.diskUtilization = diskUtilization;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self nodeRole])
    {
        [result setValue:[self nodeRole] forKey:@"nodeRole"];
    }
    if([self nodeStatus])
    {
        [result setValue:[self nodeStatus] forKey:@"nodeStatus"];
    }
    if([self cpuUtilization])
    {
        [result setValue:[self cpuUtilization] forKey:@"cpuUtilization"];
    }
    if([self memoryUtilization])
    {
        [result setValue:[self memoryUtilization] forKey:@"memoryUtilization"];
    }
    if([self diskUtilization])
    {
        [result setValue:[self diskUtilization] forKey:@"diskUtilization"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.nodeRole = [dictionary objectForKey:@"nodeRole"];
    self.nodeStatus = [dictionary objectForKey:@"nodeStatus"];
    self.cpuUtilization = [dictionary objectForKey:@"cpuUtilization"];
    self.memoryUtilization = [dictionary objectForKey:@"memoryUtilization"];
    self.diskUtilization = [dictionary objectForKey:@"diskUtilization"];
    return self;
}
 @end
@implementation DBInstanceAttribute
-(id) initWithInstanceId:(NSString*) instanceId
      instanceName:(NSString*)instanceName
      nodeType:(NSString*)nodeType
      nodeNumber:(NSNumber*)nodeNumber
      azId:(NSString*)azId
      vpcId:(NSString*)vpcId
      subnetId:(NSString*)subnetId
      instanceDomain:(NSString*)instanceDomain
      instancePort:(NSString*)instancePort
      accountName:(NSString*)accountName
      instanceStatus:(NSString*)instanceStatus
      createTime:(NSString*)createTime
      nodes:(NSArray<Node*>*)nodes
      charge:(Charge*)charge { 
     self.instanceId = instanceId;               
     self.instanceName = instanceName;               
     self.nodeType = nodeType;               
     self.nodeNumber = nodeNumber;               
     self.azId = azId;               
     self.vpcId = vpcId;               
     self.subnetId = subnetId;               
     self.instanceDomain = instanceDomain;               
     self.instancePort = instancePort;               
     self.accountName = accountName;               
     self.instanceStatus = instanceStatus;               
     self.createTime = createTime;               
     self.nodes = nodes;               
     self.charge = charge;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    if([self instanceName])
    {
        [result setValue:[self instanceName] forKey:@"instanceName"];
    }
    if([self nodeType])
    {
        [result setValue:[self nodeType] forKey:@"nodeType"];
    }
    if([self nodeNumber])
    {
        [result setValue:[self nodeNumber] forKey:@"nodeNumber"];
    }
    if([self azId])
    {
        [result setValue:[self azId] forKey:@"azId"];
    }
    if([self vpcId])
    {
        [result setValue:[self vpcId] forKey:@"vpcId"];
    }
    if([self subnetId])
    {
        [result setValue:[self subnetId] forKey:@"subnetId"];
    }
    if([self instanceDomain])
    {
        [result setValue:[self instanceDomain] forKey:@"instanceDomain"];
    }
    if([self instancePort])
    {
        [result setValue:[self instancePort] forKey:@"instancePort"];
    }
    if([self accountName])
    {
        [result setValue:[self accountName] forKey:@"accountName"];
    }
    if([self instanceStatus])
    {
        [result setValue:[self instanceStatus] forKey:@"instanceStatus"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self nodes])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self nodes] count]; i++) {
            Node* item = [[self nodes] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"nodes"];
    }
    if([self charge])
    {
        [result setValue:[[self charge] dictionary]forKey:@"charge"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    self.instanceName = [dictionary objectForKey:@"instanceName"];
    self.nodeType = [dictionary objectForKey:@"nodeType"];
    self.nodeNumber = [dictionary objectForKey:@"nodeNumber"];
    self.azId = [dictionary objectForKey:@"azId"];
    self.vpcId = [dictionary objectForKey:@"vpcId"];
    self.subnetId = [dictionary objectForKey:@"subnetId"];
    self.instanceDomain = [dictionary objectForKey:@"instanceDomain"];
    self.instancePort = [dictionary objectForKey:@"instancePort"];
    self.accountName = [dictionary objectForKey:@"accountName"];
    self.instanceStatus = [dictionary objectForKey:@"instanceStatus"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    NSArray* nodesArray = [dictionary objectForKey:@"nodes"];
    if(nodesArray&&![nodesArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [nodesArray count];i++)
        {
            Node* item = [[Node alloc]initWithDic:[nodesArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.nodes = propertyArray;
    }
    self.charge = [[Charge alloc]initWithDic:[dictionary objectForKey:@"charge"]];
    return self;
}
 @end
@implementation DBInstanceSpec
-(id) initWithInstanceName:(NSString*) instanceName
      nodeType:(NSString*)nodeType
      nodeNumber:(NSNumber*)nodeNumber
      azId:(NSString*)azId
      vpcId:(NSString*)vpcId
      subnetId:(NSString*)subnetId
      accountName:(NSString*)accountName
      accountPassword:(NSString*)accountPassword
      chargeSpec:(ChargeSpec*)chargeSpec { 
     self.instanceName = instanceName;               
     self.nodeType = nodeType;               
     self.nodeNumber = nodeNumber;               
     self.azId = azId;               
     self.vpcId = vpcId;               
     self.subnetId = subnetId;               
     self.accountName = accountName;               
     self.accountPassword = accountPassword;               
     self.chargeSpec = chargeSpec;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instanceName])
    {
        [result setValue:[self instanceName] forKey:@"instanceName"];
    }
    if([self nodeType])
    {
        [result setValue:[self nodeType] forKey:@"nodeType"];
    }
    if([self nodeNumber])
    {
        [result setValue:[self nodeNumber] forKey:@"nodeNumber"];
    }
    if([self azId])
    {
        [result setValue:[self azId] forKey:@"azId"];
    }
    if([self vpcId])
    {
        [result setValue:[self vpcId] forKey:@"vpcId"];
    }
    if([self subnetId])
    {
        [result setValue:[self subnetId] forKey:@"subnetId"];
    }
    if([self accountName])
    {
        [result setValue:[self accountName] forKey:@"accountName"];
    }
    if([self accountPassword])
    {
        [result setValue:[self accountPassword] forKey:@"accountPassword"];
    }
    if([self chargeSpec])
    {
        [result setValue:[[self chargeSpec] dictionary]forKey:@"chargeSpec"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceName = [dictionary objectForKey:@"instanceName"];
    self.nodeType = [dictionary objectForKey:@"nodeType"];
    self.nodeNumber = [dictionary objectForKey:@"nodeNumber"];
    self.azId = [dictionary objectForKey:@"azId"];
    self.vpcId = [dictionary objectForKey:@"vpcId"];
    self.subnetId = [dictionary objectForKey:@"subnetId"];
    self.accountName = [dictionary objectForKey:@"accountName"];
    self.accountPassword = [dictionary objectForKey:@"accountPassword"];
    self.chargeSpec = [[ChargeSpec alloc]initWithDic:[dictionary objectForKey:@"chargeSpec"]];
    return self;
}
 @end
@implementation DBInstance
-(id) initWithInstanceId:(NSString*) instanceId
      instanceName:(NSString*)instanceName
      nodeType:(NSString*)nodeType
      cpu:(NSNumber*)cpu
      memory:(NSNumber*)memory
      storage:(NSNumber*)storage
      nodeNumber:(NSNumber*)nodeNumber
      azId:(NSString*)azId
      vpcId:(NSString*)vpcId
      subnetId:(NSString*)subnetId
      instanceStatus:(NSString*)instanceStatus
      createTime:(NSString*)createTime
      charge:(Charge*)charge { 
     self.instanceId = instanceId;               
     self.instanceName = instanceName;               
     self.nodeType = nodeType;               
     self.cpu = cpu;               
     self.memory = memory;               
     self.storage = storage;               
     self.nodeNumber = nodeNumber;               
     self.azId = azId;               
     self.vpcId = vpcId;               
     self.subnetId = subnetId;               
     self.instanceStatus = instanceStatus;               
     self.createTime = createTime;               
     self.charge = charge;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    if([self instanceName])
    {
        [result setValue:[self instanceName] forKey:@"instanceName"];
    }
    if([self nodeType])
    {
        [result setValue:[self nodeType] forKey:@"nodeType"];
    }
    if([self cpu])
    {
        [result setValue:[self cpu] forKey:@"cpu"];
    }
    if([self memory])
    {
        [result setValue:[self memory] forKey:@"memory"];
    }
    if([self storage])
    {
        [result setValue:[self storage] forKey:@"storage"];
    }
    if([self nodeNumber])
    {
        [result setValue:[self nodeNumber] forKey:@"nodeNumber"];
    }
    if([self azId])
    {
        [result setValue:[self azId] forKey:@"azId"];
    }
    if([self vpcId])
    {
        [result setValue:[self vpcId] forKey:@"vpcId"];
    }
    if([self subnetId])
    {
        [result setValue:[self subnetId] forKey:@"subnetId"];
    }
    if([self instanceStatus])
    {
        [result setValue:[self instanceStatus] forKey:@"instanceStatus"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self charge])
    {
        [result setValue:[[self charge] dictionary]forKey:@"charge"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    self.instanceName = [dictionary objectForKey:@"instanceName"];
    self.nodeType = [dictionary objectForKey:@"nodeType"];
    self.cpu = [dictionary objectForKey:@"cpu"];
    self.memory = [dictionary objectForKey:@"memory"];
    self.storage = [dictionary objectForKey:@"storage"];
    self.nodeNumber = [dictionary objectForKey:@"nodeNumber"];
    self.azId = [dictionary objectForKey:@"azId"];
    self.vpcId = [dictionary objectForKey:@"vpcId"];
    self.subnetId = [dictionary objectForKey:@"subnetId"];
    self.instanceStatus = [dictionary objectForKey:@"instanceStatus"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.charge = [[Charge alloc]initWithDic:[dictionary objectForKey:@"charge"]];
    return self;
}
 @end
 
 


